package com.hmall.common.client;

import com.hmall.common.dto.PageDTO;
import com.hmall.common.dto.ItemDTO;
import com.hmall.common.interceptor.FeignConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(value = "itemservice",configuration = FeignConfig.class)
public interface ItemClient {
    @GetMapping("/item/list")
    PageDTO<ItemDTO> itemPageQuery(@RequestParam int page, @RequestParam int size);

    @GetMapping("/item/{id}")
    ItemDTO selectItemById(@PathVariable("id") Long id);

    @PutMapping("/item/stock/{itemId}/{num}")
    void substractStock(@PathVariable(value = "itemId") Long itemId,@PathVariable(value = "num") Integer num);

}
